/*
 * MemberShipDemoView.java
 */
package membershipdemo;


import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import org.jdesktop.application.Task;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import javax.imageio.ImageIO;
import javax.persistence.Query;
import javax.persistence.RollbackException;
import javax.swing.Box;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.jdesktop.beansbinding.AbstractBindingListener;
import org.jdesktop.beansbinding.Binding;
import org.jdesktop.beansbinding.PropertyStateEvent;

/**
 * The application's main frame.
 */
public class MemberShipDemoView extends FrameView {
        final JFileChooser chooser = new JFileChooser();
        String imagePath="";
          int rowSelected=-1;
         int backupVariable;
    public MemberShipDemoView(SingleFrameApplication app) {
        super(app);
        initComponents();
        jPanel3.setVisible(false);
        picturePanel.setLayout(new BorderLayout());    
        //Dimension d3 = new Dimension(200, 200);
         //picturePanel.setSize(d3);
         picturePanel.setPreferredSize(new Dimension(200, 200));
         picturePanel.setMinimumSize(new Dimension(200, 200));
         picturePanel.setMaximumSize(new Dimension(200, 200));
        masterTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
               rowSelected = masterTable.getSelectedRow();
                if (!e.getValueIsAdjusting()) {
                    if (rowSelected != -1) {
                        jPanel3.setVisible(true);
                        flag = 2;
                        
                        Integer Id = (Integer) masterTable.getValueAt(rowSelected, 18);
                        memberShipId = (Integer) masterTable.getValueAt(rowSelected, 6);
                        nameString = (String) masterTable.getValueAt(rowSelected, 5);
                        Date birthDatet = (Date) masterTable.getValueAt(rowSelected,7);
                        String bithplace = (String) masterTable.getValueAt(rowSelected, 8);
                        Long natioID = (Long) masterTable.getValueAt(rowSelected, 0);
                        Date nationIDDate = (Date) masterTable.getValueAt(rowSelected, 9);
                        String currentJobt = (String) masterTable.getValueAt(rowSelected, 3);
                        String Jobdegree = (String) masterTable.getValueAt(rowSelected, 10);
                        Date hireDateT = (Date) masterTable.getValueAt(rowSelected,11);
                        String placeoflive = (String) masterTable.getValueAt(rowSelected,4);
                        Date joinDateT = (Date) masterTable.getValueAt(rowSelected, 1);
                        Date startDate = (Date) masterTable.getValueAt(rowSelected,12);
                        String workDist = (String) masterTable.getValueAt(rowSelected,2);
                        if (!workDist.equals("محكمة")) {
                            jRadioButton1.setSelected(true);
                        } else {
                            jRadioButton2.setSelected(true);
                        }
                        String phone = (String) masterTable.getValueAt(rowSelected,13);
                        String mobileT = (String) masterTable.getValueAt(rowSelected, 14);
                        String certificate = (String) masterTable.getValueAt(rowSelected, 15);
                        String emailT = (String) masterTable.getValueAt(rowSelected, 16);
                        String path=(String)masterTable.getValueAt(rowSelected, 17);
                        
                        ID.setText("" + Id);
                        ID.setEnabled(false);
                        membershipID.setText("" + memberShipId);
                        name.setText(nameString);
                        birthDate.setDate(birthDatet);
                        placeOfBirth.setText(bithplace);
                        nationalID.setText("" + natioID);
                        dateOfNatID.setDate(nationIDDate);
                        currentJob.setText(currentJobt);
                        jobDegree.setText(Jobdegree);
                        hireDate.setDate(hireDateT);
                        address.setText(placeoflive);
                        joiningDate.setDate(joinDateT);
                        eductaion.setText(certificate);
                        deductionDate.setDate(startDate);
                        homePhone.setText(phone);
                        mobile.setText(mobileT);
                        email.setText(emailT);

                        
                        imagePath=path;
                         try {
                   
                    System.out.println(" imagepath "+imagePath);
                    Image bi = ImageIO.read(new File(path));
                 
                    if (bi != null){
                       picturePanel.removeAll();
                            REP(bi);}
                    else
                    JOptionPane.showMessageDialog(null, "File is not an image!");
                    } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                    "Error Reading File!");
                    }
                        
                        
                        
                        
                        setSaveNeeded(true);
                        resetSubvention();
                        edit_Subvention_Button.setEnabled(false);
                        save_Subvention_Button.setEnabled(false);
                        saveButton.setEnabled(true);
                     //   hideSubvention();
                    }
                }
            }
        });

        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {

            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String) (evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer) (evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });

        // tracking table selection
        masterTable.getSelectionModel().addListSelectionListener(
                new ListSelectionListener() {
                    public void valueChanged(ListSelectionEvent e) {
                        firePropertyChange("recordSelected", !isRecordSelected(), isRecordSelected());
                    }
                });
        detailTable.getSelectionModel().addListSelectionListener(
                new ListSelectionListener() {
                    public void valueChanged(ListSelectionEvent e) {
                        firePropertyChange("detailRecordSelected", !isDetailRecordSelected(), isDetailRecordSelected());
                    edit_Subvention_Button.setEnabled(true);
                    }
                });

        // tracking changes to save
        bindingGroup.addBindingListener(new AbstractBindingListener() {
            @Override
            public void targetChanged(Binding binding, PropertyStateEvent event) {
                // save action observes saveNeeded property
                setSaveNeeded(true);
            }
        });

        // have a transaction started
        entityManager.getTransaction().begin();
    }

    public boolean isSaveNeeded() {
        return saveNeeded;
    }

    private void setSaveNeeded(boolean saveNeeded) {
        if (saveNeeded != this.saveNeeded) {
            this.saveNeeded = saveNeeded;
            firePropertyChange("saveNeeded", !saveNeeded, saveNeeded);
        }
    }
    

    public boolean isRecordSelected() {
        return masterTable.getSelectedRow() != -1;
    }

    public boolean isDetailRecordSelected() {
        return detailTable.getSelectedRow() != -1;
    }

    @Action
    public void newRecord() {
        jPanel3.setVisible(true);
        reset();
        setIDValue();
        flag = 1;
        setSaveNeeded(true);
    }
    
    public void setIDValue(){
        int ListSize=list.size()+1;
        ID.setText(ListSize+"");
        ID.setEnabled(false);
    }
    
    public void setSubventionID(){
        try{
            Query query=entityManager.createNamedQuery("Subvention.findAll");
            List list=query.getResultList();
            System.out.println("Subvention List Size: "+list.size());
            int ListSize=list.size()+1;
            id_Textfield.setText(ListSize+"");
            id_Textfield.setEnabled(false);
        }catch(Exception ex){
            ex.printStackTrace();
        }
    }

    @Action(enabledProperty = "recordSelected")
    public void deleteRecord() {
        Object[] options = {"لا", "نعم"};
        int n = JOptionPane.showOptionDialog(null,
                "هل تريد حذف العضو",
                " حذف ",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE,
                null, //do not use a custom Icon
                options, //the titles of buttons
                options[0]); //default button title
        if (n == 1) {
            int[] selected = masterTable.getSelectedRows();
            List<membershipdemo.Members> toRemove = new ArrayList<membershipdemo.Members>(selected.length);
            for (int idx = 0; idx < selected.length; idx++) {
                membershipdemo.Members m = list.get(masterTable.convertRowIndexToModel(selected[idx]));
                toRemove.add(m);
                entityManager.remove(m);
            }
            list.removeAll(toRemove);

            try {
                entityManager.getTransaction().commit();
                entityManager.getTransaction().begin();
                reset();
              JOptionPane.showMessageDialog(null, "تم الحذف بنجاح","تم الحذف بنجاح",JOptionPane.INFORMATION_MESSAGE);
            } catch (RollbackException ex) {
                ex.printStackTrace();
JOptionPane.showMessageDialog(null,"حدث خطأ فى الحذف" ," حدث حطأ",JOptionPane.ERROR_MESSAGE);
            }
        }
    }

    @Action(enabledProperty = "recordSelected")
    public void newDetailRecord() {
        
        id_Label.setVisible(true);
        id_Textfield.setVisible(true);

        mem_Id_Label.setVisible(true);
        mem_Name_Textfield.setVisible(true);
        mem_Name_Textfield.setText(nameString);
        service_Type_Label.setVisible(true);
        service_Type_ComboBox.setVisible(true);

        request_Date_Label.setVisible(true);
        request_Date_DateChooser.setVisible(true);

        incoming_Number_Label.setVisible(true);
        incoming_Number_Textfield.setVisible(true);

        amount_Label.setVisible(true);
        amount_Textfield.setVisible(true);

        receive_Date_Label.setVisible(true);
        receive_Date_DateChooser.setVisible(true);

        notes_Label.setVisible(true);
        jScrollPane1.setVisible(true);

        subventionFlag = 1;
        save_Subvention_Button.setVisible(true);
        Subvention_Refresh_Button.setEnabled(true);
        Subvention_Refresh_Button.setVisible(true);
        save_Subvention_Button.setEnabled(true);
        resetSubvention();
        setSubventionID();
    }

    @Action(enabledProperty = "detailRecordSelected")
    public void deleteDetailRecord() {
        Object[] options = {"لا", "نعم"};
        int reply = JOptionPane.showOptionDialog(null,
                "هل تريد الحذف",
                " حذف ",
                JOptionPane.YES_NO_OPTION,
                JOptionPane.QUESTION_MESSAGE,
                null, //do not use a custom Icon
                options, //the titles of buttons
                options[0]);
        if (reply == 1) {
            int index = masterTable.getSelectedRow();
            membershipdemo.Members m = list.get(masterTable.convertRowIndexToModel(index));
            Collection<membershipdemo.Subvention> ss = m.getSubventionList();
            int[] selected = detailTable.getSelectedRows();
            List<membershipdemo.Subvention> toRemove = new ArrayList<membershipdemo.Subvention>(selected.length);
            for (int idx = 0; idx < selected.length; idx++) {
                selected[idx] = detailTable.convertRowIndexToModel(selected[idx]);
                int count = 0;
                Iterator<membershipdemo.Subvention> iter = ss.iterator();
                while (count++ < selected[idx]) {
                    iter.next();
                }
                membershipdemo.Subvention s = iter.next();
                toRemove.add(s);
                entityManager.remove(s);
            }
            ss.removeAll(toRemove);
            masterTable.clearSelection();
            masterTable.setRowSelectionInterval(index, index);
            try{
                entityManager.getTransaction().commit();
                entityManager.getTransaction().begin();
                resetSubvention();
                Subvention_Refresh_Button.setEnabled(true);
                   JOptionPane.showMessageDialog(null, "تم الحذف بنجاح","تم الحذف بنجاح",JOptionPane.INFORMATION_MESSAGE);
            }catch(Exception e){
                 e.printStackTrace();
                 JOptionPane.showMessageDialog(null,"حدث خطأ فى الحذف" ," حدث حطأ",JOptionPane.ERROR_MESSAGE);
            }
            save_Subvention_Button.setEnabled(false);
        }
    }

    @Action(enabledProperty = "saveNeeded")
    public Task save() {
            if(!validateEmail(email.getText()))
        {
            errorLabel.setText("البريد الالكترونى غير صحيح  ");
        }
        
        else if(!validateNumber(nationalID.getText())||nationalID.getText().length()<14){
        errorLabel.setText("الرقم القومى غير صحيح");
        }
        else if(validateDate(birthDate.getDate())){
            errorLabel.setText("تاريخ الميلاد غير صحيح ");
        }
                 else if(validateDate(joiningDate.getDate())){
            errorLabel.setText("تاريخ الانضمام غير صحيح  ");
        }
                         else if(validateDate(hireDate.getDate())){
            errorLabel.setText("تاريخ التعيين غير صحيح  ");
        }
                                else if(validateDate(deductionDate.getDate())){
            errorLabel.setText("تاريخ   بد اية الخصم غير صحيحح  ");
        }   
              else if(validateDate(dateOfNatID.getDate())){
            errorLabel.setText("تارخ استخراج بطاقة الرقم القومى غير صحيح ");
        } 
        else{
         return  new SaveTask(getApplication());
        
        }
           
        return null;
    }

    private class SaveTask extends Task {

        SaveTask(org.jdesktop.application.Application app) {
            super(app);
        }

        @Override
        protected Void doInBackground() {
            try {
                membershipdemo.Members mm = new membershipdemo.Members();
                mm.setAddress(address.getText());
                mm.setCurrentJob(currentJob.getText());
                mm.setDateOfNatId(dateOfNatID.getDate());
                mm.setDateOfAnnouncement(new Date());
                mm.setDateOfBirth(birthDate.getDate());
                mm.setDeductionDate(deductionDate.getDate());
                //mm.setDateOfNatId(new Date());
                mm.setEducation(eductaion.getText());
                mm.setEmail(email.getText());
                mm.setHireDate(hireDate.getDate());
                mm.setHomePhone(homePhone.getText());
                if (!(ID.getText().equalsIgnoreCase("") || ID.getText().equalsIgnoreCase(null))) {
                    mm.setId(Integer.parseInt(ID.getText()));
                }
                mm.setImagePath("Not Handled Yet");
                mm.setJobDegree(jobDegree.getText());
                mm.setJoiningDate(joiningDate.getDate());
                if (!(membershipID.getText().equalsIgnoreCase("") || membershipID.getText().equalsIgnoreCase(null))) {
                    mm.setMemId(Integer.parseInt(membershipID.getText()));
                }
                mm.setMemName(name.getText());
                mm.setMobile(mobile.getText());
                if (!(nationalID.getText().equalsIgnoreCase("") || nationalID.getText().equalsIgnoreCase(null))) {
                    mm.setNatId(Long.parseLong(nationalID.getText()));
                }
                mm.setPlaceOfBirth(placeOfBirth.getText());
                    mm.setImagePath(imagePath);
                if (jRadioButton1.isSelected()) {
                    mm.setWorkPlace("نيابة");
                } else {
                    mm.setWorkPlace("محكمة");
                }
                if (flag == 1) {
                    entityManager.persist(mm);

                }
                if (flag == 2) {
                    entityManager.merge(mm);
                }
                entityManager.getTransaction().commit();
                entityManager.getTransaction().begin();
                reset();
                 JOptionPane.showMessageDialog(null, "تم الحفظ  بنجاح"," تم الحفظ بنجاح",JOptionPane.INFORMATION_MESSAGE);
                   Task ref=refresh();
            ref.execute();
            } catch (RollbackException rex) {
                rex.printStackTrace();
                entityManager.getTransaction().begin();
                List<membershipdemo.Members> merged = new ArrayList<membershipdemo.Members>(list.size());
                for (membershipdemo.Members m : list) {
                    merged.add(entityManager.merge(m));
                }
                list.clear();
                list.addAll(merged);
                rex.getMessage();     
                errorLabel.setText("حدث خطأ فى حفظ التغيرات ");
                JOptionPane.showMessageDialog(null,"خطأ","حدث خطأ فى حفظ التغيرات ",JOptionPane.ERROR_MESSAGE);
                 setSaveNeeded(true);
            }
          
            return null;
        }

        @Override
        protected void finished() {
            setSaveNeeded(false);
        }
    }

    private void reset() {
        // reset all fields to be empty
        ID.setText("");
        membershipID.setText("");
        name.setText("");
        nationalID.setText("");
        placeOfBirth.setText("");
        currentJob.setText("");
        jobDegree.setText("");
        address.setText("");
        eductaion.setText("");
        homePhone.setText("");
        mobile.setText("");
        birthDate.setDate(null);
        dateOfNatID.setDate(null);
        hireDate.setDate(null);
        joiningDate.setDate(null);
        deductionDate.setDate(null);
        email.setText("");
        picturePanel.removeAll();
       errorLabel.setText(" ");
    }
    
    private void resetSubvention() {
        // reset all fields to be empty
        id_Textfield.setText("");
       // mem_Name_Textfield.setText("");
        request_Date_DateChooser.setDate(null);
        incoming_Number_Textfield.setText("");
        amount_Textfield.setText("");
        receive_Date_DateChooser.setDate(null);
        notes_TextArea.setText("");
        service_Type_ComboBox.setSelectedIndex(0);
    }

    /**
     * An example action method showing how to create asynchronous tasks
     * (running on background) and how to show their progress. Note the
     * artificial 'Thread.sleep' calls making the task long enough to see the
     * progress visualization - remove the sleeps for real application.
     */
     @Action
    public Task refresh() {
        System.out.println(" refreshing "+rowSelected);
        backupVariable=rowSelected;
        return new RefreshTask(getApplication());
    }

    private class RefreshTask extends Task {

        RefreshTask(org.jdesktop.application.Application app) {
            super(app);
            System.out.println(" refrsh after super");
        }

        @SuppressWarnings("unchecked")
        @Override
        protected Void doInBackground() {
            try {
                System.out.println(" refreshing in background ");
                setProgress(0, 0, 4);
                setMessage("Rolling back the current changes...");
                setProgress(1, 0, 4);
                entityManager.getTransaction().rollback();
                Thread.sleep(1000L); // remove for real app
                setProgress(2, 0, 4);

                setMessage("Starting a new transaction...");
                entityManager.getTransaction().begin();
                Thread.sleep(500L); // remove for real app
                setProgress(3, 0, 4);

                setMessage("Fetching new data...");
                java.util.Collection data = query.getResultList();
                for (Object entity : data) {
                    entityManager.refresh(entity);
                }
                Thread.sleep(1300L); // remove for real app
                setProgress(4, 0, 4);

                Thread.sleep(150L); // remove for real app
                list.clear();
                list.addAll(data);
            } catch (InterruptedException ignore) {
            }
            
            setIDValue();
            masterTable.setRowSelectionInterval(backupVariable, backupVariable); 
            return null;
        }

        @Override
        protected void finished() {
            setMessage("Done.");
            setSaveNeeded(false);
        }
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = MemberShipDemoApp.getApplication().getMainFrame();
            aboutBox = new MemberShipDemoAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        MemberShipDemoApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        mainPanel = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        masterScrollPane = new javax.swing.JScrollPane();
        masterTable = new javax.swing.JTable();
        newButton = new javax.swing.JButton();
        deleteButton = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        membershipID = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        ID = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        name = new javax.swing.JTextField();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        placeOfBirth = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        nationalID = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        currentJob = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        jobDegree = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        address = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        eductaion = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        homePhone = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        mobile = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        email = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        birthDate = new com.toedter.calendar.JDateChooser();
        dateOfNatID = new com.toedter.calendar.JDateChooser();
        hireDate = new com.toedter.calendar.JDateChooser();
        joiningDate = new com.toedter.calendar.JDateChooser();
        deductionDate = new com.toedter.calendar.JDateChooser();
        saveButton = new javax.swing.JButton();
        refreshButton = new javax.swing.JButton();
        progressBar = new javax.swing.JProgressBar();
        picturePanel = new javax.swing.JPanel();
        browes = new javax.swing.JButton();
        errorLabel = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        detailScrollPane = new javax.swing.JScrollPane();
        detailTable = new javax.swing.JTable();
        newDetailButton = new javax.swing.JButton();
        deleteDetailButton = new javax.swing.JButton();
        id_Label = new javax.swing.JLabel();
        mem_Id_Label = new javax.swing.JLabel();
        service_Type_Label = new javax.swing.JLabel();
        request_Date_Label = new javax.swing.JLabel();
        incoming_Number_Label = new javax.swing.JLabel();
        amount_Label = new javax.swing.JLabel();
        receive_Date_Label = new javax.swing.JLabel();
        notes_Label = new javax.swing.JLabel();
        id_Textfield = new javax.swing.JTextField();
        mem_Name_Textfield = new javax.swing.JTextField();
        service_Type_ComboBox = new javax.swing.JComboBox();
        request_Date_DateChooser = new com.toedter.calendar.JDateChooser();
        incoming_Number_Textfield = new javax.swing.JTextField();
        amount_Textfield = new javax.swing.JTextField();
        receive_Date_DateChooser = new com.toedter.calendar.JDateChooser();
        jScrollPane1 = new javax.swing.JScrollPane();
        notes_TextArea = new javax.swing.JTextArea();
        save_Subvention_Button = new javax.swing.JButton();
        edit_Subvention_Button = new javax.swing.JButton();
        Subvention_Refresh_Button = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        Report_1_Button = new javax.swing.JButton();
        Report_2_Button = new javax.swing.JButton();
        Report_3_Button = new javax.swing.JButton();
        Report_4_Button = new javax.swing.JButton();
        Report_5_Button = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem newRecordMenuItem = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JSeparator();
        javax.swing.JMenuItem saveMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenuItem refreshMenuItem = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JSeparator();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(membershipdemo.MemberShipDemoApp.class).getContext().getResourceMap(MemberShipDemoView.class);
        entityManager = java.beans.Beans.isDesignTime() ? null : javax.persistence.Persistence.createEntityManagerFactory(resourceMap.getString("entityManager.persistenceUnit")).createEntityManager(); // NOI18N
        query = java.beans.Beans.isDesignTime() ? null : entityManager.createQuery(resourceMap.getString("query.query")); // NOI18N
        list = java.beans.Beans.isDesignTime() ? java.util.Collections.emptyList() : org.jdesktop.observablecollections.ObservableCollections.observableList(query.getResultList());
        buttonGroup1 = new javax.swing.ButtonGroup();

        mainPanel.setName("mainPanel"); // NOI18N

        jTabbedPane1.setTabPlacement(javax.swing.JTabbedPane.RIGHT);
        jTabbedPane1.setName("jTabbedPane1"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N

        masterScrollPane.setName("masterScrollPane"); // NOI18N

        masterTable.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        masterTable.setName("masterTable"); // NOI18N

        org.jdesktop.swingbinding.JTableBinding jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, list, masterTable);
        org.jdesktop.swingbinding.JTableBinding.ColumnBinding columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${natId}"));
        columnBinding.setColumnName("Nat Id");
        columnBinding.setColumnClass(Long.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${joiningDate}"));
        columnBinding.setColumnName("Joining Date");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${workPlace}"));
        columnBinding.setColumnName("Work Place");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${currentJob}"));
        columnBinding.setColumnName("Current Job");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${address}"));
        columnBinding.setColumnName("Address");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${memName}"));
        columnBinding.setColumnName("Mem Name");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${memId}"));
        columnBinding.setColumnName("Mem Id");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${dateOfBirth}"));
        columnBinding.setColumnName("Date Of Birth");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${placeOfBirth}"));
        columnBinding.setColumnName("Place Of Birth");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${dateOfNatId}"));
        columnBinding.setColumnName("Date Of Nat Id");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${jobDegree}"));
        columnBinding.setColumnName("Job Degree");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${hireDate}"));
        columnBinding.setColumnName("Hire Date");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${deductionDate}"));
        columnBinding.setColumnName("Deduction Date");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${homePhone}"));
        columnBinding.setColumnName("Home Phone");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${mobile}"));
        columnBinding.setColumnName("Mobile");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${education}"));
        columnBinding.setColumnName("Education");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${email}"));
        columnBinding.setColumnName("Email");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${imagePath}"));
        columnBinding.setColumnName("Image Path");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${id}"));
        columnBinding.setColumnName("Id");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        masterScrollPane.setViewportView(masterTable);
        masterTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("masterTable.columnModel.title5")); // NOI18N
        masterTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("masterTable.columnModel.title11")); // NOI18N
        masterTable.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("masterTable.columnModel.title13")); // NOI18N
        masterTable.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("masterTable.columnModel.title7")); // NOI18N
        masterTable.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("masterTable.columnModel.title10")); // NOI18N
        masterTable.getColumnModel().getColumn(5).setHeaderValue(resourceMap.getString("masterTable.columnModel.title2")); // NOI18N
        masterTable.getColumnModel().getColumn(6).setHeaderValue(resourceMap.getString("masterTable.columnModel.title1")); // NOI18N
        masterTable.getColumnModel().getColumn(7).setMinWidth(0);
        masterTable.getColumnModel().getColumn(7).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(7).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(7).setHeaderValue(resourceMap.getString("masterTable.columnModel.title3")); // NOI18N
        masterTable.getColumnModel().getColumn(8).setMinWidth(0);
        masterTable.getColumnModel().getColumn(8).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(8).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(8).setHeaderValue(resourceMap.getString("masterTable.columnModel.title4")); // NOI18N
        masterTable.getColumnModel().getColumn(9).setMinWidth(0);
        masterTable.getColumnModel().getColumn(9).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(9).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(9).setHeaderValue(resourceMap.getString("masterTable.columnModel.title6")); // NOI18N
        masterTable.getColumnModel().getColumn(10).setMinWidth(0);
        masterTable.getColumnModel().getColumn(10).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(10).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(10).setHeaderValue(resourceMap.getString("masterTable.columnModel.title8")); // NOI18N
        masterTable.getColumnModel().getColumn(11).setMinWidth(0);
        masterTable.getColumnModel().getColumn(11).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(11).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(11).setHeaderValue(resourceMap.getString("masterTable.columnModel.title9")); // NOI18N
        masterTable.getColumnModel().getColumn(12).setMinWidth(0);
        masterTable.getColumnModel().getColumn(12).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(12).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(12).setHeaderValue(resourceMap.getString("masterTable.columnModel.title12")); // NOI18N
        masterTable.getColumnModel().getColumn(13).setMinWidth(0);
        masterTable.getColumnModel().getColumn(13).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(13).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(13).setHeaderValue(resourceMap.getString("masterTable.columnModel.title15")); // NOI18N
        masterTable.getColumnModel().getColumn(14).setMinWidth(0);
        masterTable.getColumnModel().getColumn(14).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(14).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(14).setHeaderValue(resourceMap.getString("masterTable.columnModel.title16")); // NOI18N
        masterTable.getColumnModel().getColumn(15).setMinWidth(0);
        masterTable.getColumnModel().getColumn(15).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(15).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(15).setHeaderValue(resourceMap.getString("masterTable.columnModel.title17")); // NOI18N
        masterTable.getColumnModel().getColumn(16).setMinWidth(0);
        masterTable.getColumnModel().getColumn(16).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(16).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(16).setHeaderValue(resourceMap.getString("masterTable.columnModel.title18")); // NOI18N
        masterTable.getColumnModel().getColumn(17).setMinWidth(0);
        masterTable.getColumnModel().getColumn(17).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(17).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(17).setHeaderValue(resourceMap.getString("masterTable.columnModel.title19")); // NOI18N
        masterTable.getColumnModel().getColumn(18).setMinWidth(0);
        masterTable.getColumnModel().getColumn(18).setPreferredWidth(0);
        masterTable.getColumnModel().getColumn(18).setMaxWidth(0);
        masterTable.getColumnModel().getColumn(18).setHeaderValue(resourceMap.getString("masterTable.columnModel.title0")); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(membershipdemo.MemberShipDemoApp.class).getContext().getActionMap(MemberShipDemoView.class, this);
        newButton.setAction(actionMap.get("newRecord")); // NOI18N
        newButton.setText(resourceMap.getString("newButton.text")); // NOI18N
        newButton.setName("newButton"); // NOI18N

        deleteButton.setAction(actionMap.get("deleteRecord")); // NOI18N
        deleteButton.setText(resourceMap.getString("deleteButton.text")); // NOI18N
        deleteButton.setName("deleteButton"); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N

        membershipID.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        membershipID.setText(resourceMap.getString("membershipID.text")); // NOI18N
        membershipID.setName("membershipID"); // NOI18N

        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        ID.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        ID.setText(resourceMap.getString("ID.text")); // NOI18N
        ID.setToolTipText(resourceMap.getString("ID.toolTipText")); // NOI18N
        ID.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
        ID.setName("ID"); // NOI18N

        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        name.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        name.setText(resourceMap.getString("name.text")); // NOI18N
        name.setName("name"); // NOI18N

        buttonGroup1.add(jRadioButton1);
        jRadioButton1.setText(resourceMap.getString("jRadioButton1.text")); // NOI18N
        jRadioButton1.setName("jRadioButton1"); // NOI18N

        buttonGroup1.add(jRadioButton2);
        jRadioButton2.setSelected(true);
        jRadioButton2.setText(resourceMap.getString("jRadioButton2.text")); // NOI18N
        jRadioButton2.setName("jRadioButton2"); // NOI18N

        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        placeOfBirth.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        placeOfBirth.setText(resourceMap.getString("placeOfBirth.text")); // NOI18N
        placeOfBirth.setName("placeOfBirth"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        nationalID.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        nationalID.setText(resourceMap.getString("nationalID.text")); // NOI18N
        nationalID.setName("nationalID"); // NOI18N

        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
        jLabel9.setName("jLabel9"); // NOI18N

        jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
        jLabel10.setName("jLabel10"); // NOI18N

        currentJob.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        currentJob.setText(resourceMap.getString("currentJob.text")); // NOI18N
        currentJob.setName("currentJob"); // NOI18N

        jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
        jLabel11.setName("jLabel11"); // NOI18N

        jobDegree.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jobDegree.setText(resourceMap.getString("jobDegree.text")); // NOI18N
        jobDegree.setName("jobDegree"); // NOI18N

        jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText(resourceMap.getString("jLabel13.text")); // NOI18N
        jLabel13.setName("jLabel13"); // NOI18N

        address.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        address.setText(resourceMap.getString("address.text")); // NOI18N
        address.setName("address"); // NOI18N

        jLabel14.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel14.setText(resourceMap.getString("jLabel14.text")); // NOI18N
        jLabel14.setName("jLabel14"); // NOI18N

        eductaion.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        eductaion.setText(resourceMap.getString("education.text")); // NOI18N
        eductaion.setName("education"); // NOI18N

        jLabel15.setText(resourceMap.getString("jLabel15.text")); // NOI18N
        jLabel15.setName("jLabel15"); // NOI18N

        jLabel16.setText(resourceMap.getString("jLabel16.text")); // NOI18N
        jLabel16.setName("jLabel16"); // NOI18N

        homePhone.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        homePhone.setText(resourceMap.getString("homePhone.text")); // NOI18N
        homePhone.setName("homePhone"); // NOI18N

        jLabel17.setText(resourceMap.getString("jLabel17.text")); // NOI18N
        jLabel17.setName("jLabel17"); // NOI18N

        mobile.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        mobile.setText(resourceMap.getString("mobile.text")); // NOI18N
        mobile.setName("mobile"); // NOI18N

        jLabel18.setText(resourceMap.getString("jLabel18.text")); // NOI18N
        jLabel18.setName("jLabel18"); // NOI18N

        email.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        email.setText(resourceMap.getString("email.text")); // NOI18N
        email.setName("email"); // NOI18N

        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel19.setText(resourceMap.getString("jLabel19.text")); // NOI18N
        jLabel19.setName("jLabel19"); // NOI18N

        birthDate.setName("birthDate"); // NOI18N

        dateOfNatID.setName("dateOfNatID"); // NOI18N

        hireDate.setName("hireDate"); // NOI18N

        joiningDate.setName("joiningDate"); // NOI18N

        deductionDate.setName("deductionDate"); // NOI18N

        saveButton.setAction(actionMap.get("save")); // NOI18N
        saveButton.setText(resourceMap.getString("saveButton.text")); // NOI18N
        saveButton.setName("saveButton"); // NOI18N
        saveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saveButtonActionPerformed(evt);
            }
        });

        refreshButton.setAction(actionMap.get("refresh")); // NOI18N
        refreshButton.setText(resourceMap.getString("refreshButton.text")); // NOI18N
        refreshButton.setName("refreshButton"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        picturePanel.setMaximumSize(new java.awt.Dimension(200, 200));
        picturePanel.setName("picturePanel"); // NOI18N
        picturePanel.setLayout(new java.awt.BorderLayout());

        browes.setText(resourceMap.getString("browes.text")); // NOI18N
        browes.setName("browes"); // NOI18N
        browes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                browesActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 424, Short.MAX_VALUE)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(mobile, javax.swing.GroupLayout.PREFERRED_SIZE, 162, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(33, 33, 33)
                                .addComponent(homePhone, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(email))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel18, javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel16, javax.swing.GroupLayout.Alignment.TRAILING)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(deductionDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(joiningDate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 174, Short.MAX_VALUE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addGap(25, 25, 25)
                                .addComponent(picturePanel, javax.swing.GroupLayout.DEFAULT_SIZE, 8, Short.MAX_VALUE)
                                .addGap(237, 237, 237))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                .addComponent(hireDate, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(jRadioButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(60, 60, 60)
                                        .addComponent(jRadioButton2))
                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                .addComponent(jobDegree)
                                                .addComponent(dateOfNatID, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE))
                                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(jLabel15, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(browes))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(eductaion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
                                            .addComponent(name, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addComponent(placeOfBirth, javax.swing.GroupLayout.DEFAULT_SIZE, 114, Short.MAX_VALUE)
                                                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                        .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(nationalID, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
                                                    .addComponent(currentJob, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
                                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                                        .addComponent(jLabel6)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(birthDate, javax.swing.GroupLayout.DEFAULT_SIZE, 222, Short.MAX_VALUE))))
                                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                                .addComponent(membershipID, javax.swing.GroupLayout.DEFAULT_SIZE, 150, Short.MAX_VALUE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addGap(49, 49, 49)
                                                .addComponent(ID, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(address, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE))))
                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                .addComponent(jLabel10)
                                                .addComponent(jLabel5, javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                                    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addGap(8, 8, 8))
                                                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                            .addComponent(jLabel7)))
                                    .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                                .addGap(629, 629, 629)
                                .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addGap(111, 111, 111)
                                .addComponent(saveButton, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(refreshButton, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 240, Short.MAX_VALUE)
                                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(ID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(membershipID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(browes))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel4)
                            .addComponent(jRadioButton2)
                            .addComponent(jRadioButton1))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel5)
                                .addComponent(jLabel6)
                                .addComponent(placeOfBirth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(birthDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(nationalID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(dateOfNatID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(picturePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(currentJob, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel10)
                        .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jobDegree, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(hireDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(joiningDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jLabel14, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(address)
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel19, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(eductaion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, 22, Short.MAX_VALUE))
                        .addGap(12, 12, 12)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(mobile, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(homePhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(email, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(saveButton)
                                .addComponent(refreshButton))
                            .addGroup(jPanel3Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(45, 45, 45))
                    .addComponent(deductionDate, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        errorLabel.setForeground(resourceMap.getColor("errorLabel.foreground")); // NOI18N
        errorLabel.setText(resourceMap.getString("errorLabel.text")); // NOI18N
        errorLabel.setName("errorLabel"); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(masterScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1009, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(errorLabel)
                        .addGap(156, 156, 156)
                        .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(33, 33, 33)
                        .addComponent(deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(433, 433, 433))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(masterScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(newButton, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(deleteButton, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(errorLabel)))
                    .addComponent(masterScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        jTabbedPane1.addTab(resourceMap.getString("jPanel1.TabConstraints.tabTitle"), jPanel1); // NOI18N

        jPanel2.setName("jPanel2"); // NOI18N

        detailScrollPane.setName("detailScrollPane"); // NOI18N

        detailTable.setName("detailTable"); // NOI18N

        org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement.subventionList}");
        jTableBinding = org.jdesktop.swingbinding.SwingBindings.createJTableBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ_WRITE, masterTable, eLProperty, detailTable);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${requestDate}"));
        columnBinding.setColumnName("Request Date");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${receiveDate}"));
        columnBinding.setColumnName("Receive Date");
        columnBinding.setColumnClass(java.util.Date.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${notes}"));
        columnBinding.setColumnName("Notes");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${amount}"));
        columnBinding.setColumnName("Amount");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${incomingNumber}"));
        columnBinding.setColumnName("Incoming Number");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${serviceType}"));
        columnBinding.setColumnName("Service Type");
        columnBinding.setColumnClass(String.class);
        columnBinding.setEditable(false);
        columnBinding = jTableBinding.addColumnBinding(org.jdesktop.beansbinding.ELProperty.create("${id}"));
        columnBinding.setColumnName("Id");
        columnBinding.setColumnClass(Integer.class);
        columnBinding.setEditable(false);
        jTableBinding.setSourceUnreadableValue(java.util.Collections.emptyList());
        bindingGroup.addBinding(jTableBinding);
        jTableBinding.bind();
        detailScrollPane.setViewportView(detailTable);
        detailTable.getColumnModel().getColumn(0).setMinWidth(0);
        detailTable.getColumnModel().getColumn(0).setPreferredWidth(0);
        detailTable.getColumnModel().getColumn(0).setMaxWidth(0);
        detailTable.getColumnModel().getColumn(0).setHeaderValue(resourceMap.getString("detailTable.columnModel.title2")); // NOI18N
        detailTable.getColumnModel().getColumn(1).setMinWidth(0);
        detailTable.getColumnModel().getColumn(1).setPreferredWidth(0);
        detailTable.getColumnModel().getColumn(1).setMaxWidth(0);
        detailTable.getColumnModel().getColumn(1).setHeaderValue(resourceMap.getString("detailTable.columnModel.title5")); // NOI18N
        detailTable.getColumnModel().getColumn(2).setMinWidth(0);
        detailTable.getColumnModel().getColumn(2).setPreferredWidth(0);
        detailTable.getColumnModel().getColumn(2).setMaxWidth(0);
        detailTable.getColumnModel().getColumn(2).setHeaderValue(resourceMap.getString("detailTable.columnModel.title6")); // NOI18N
        detailTable.getColumnModel().getColumn(3).setHeaderValue(resourceMap.getString("detailTable.columnModel.title4")); // NOI18N
        detailTable.getColumnModel().getColumn(4).setHeaderValue(resourceMap.getString("detailTable.columnModel.title3")); // NOI18N
        detailTable.getColumnModel().getColumn(5).setHeaderValue(resourceMap.getString("detailTable.columnModel.title1")); // NOI18N
        detailTable.getColumnModel().getColumn(6).setHeaderValue(resourceMap.getString("detailTable.columnModel.title0")); // NOI18N

        newDetailButton.setAction(actionMap.get("newDetailRecord")); // NOI18N
        newDetailButton.setText(resourceMap.getString("newDetailButton.text")); // NOI18N
        newDetailButton.setName("newDetailButton"); // NOI18N
        newDetailButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newDetailButtonActionPerformed(evt);
            }
        });

        deleteDetailButton.setAction(actionMap.get("deleteDetailRecord")); // NOI18N
        deleteDetailButton.setText(resourceMap.getString("deleteDetailButton.text")); // NOI18N
        deleteDetailButton.setName("deleteDetailButton"); // NOI18N
        deleteDetailButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deleteDetailButtonActionPerformed(evt);
            }
        });

        id_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        id_Label.setText(resourceMap.getString("id_Label.text")); // NOI18N
        id_Label.setName("id_Label"); // NOI18N
        id_Label.setVisible(false);

        mem_Id_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        mem_Id_Label.setText(resourceMap.getString("mem_Id_Iabel.text")); // NOI18N
        mem_Id_Label.setName("mem_Id_Iabel"); // NOI18N
        mem_Id_Label.setVisible(false);

        service_Type_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        service_Type_Label.setText(resourceMap.getString("service_Type_Label.text")); // NOI18N
        service_Type_Label.setName("service_Type_Label"); // NOI18N
        service_Type_Label.setVisible(false);

        request_Date_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        request_Date_Label.setText(resourceMap.getString("request_Date_Label.text")); // NOI18N
        request_Date_Label.setName("request_Date_Label"); // NOI18N
        request_Date_Label.setVisible(false);

        incoming_Number_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        incoming_Number_Label.setText(resourceMap.getString("incoming_Number_Label.text")); // NOI18N
        incoming_Number_Label.setName("incoming_Number_Label"); // NOI18N
        incoming_Number_Label.setVisible(false);

        amount_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        amount_Label.setText(resourceMap.getString("amount_Label.text")); // NOI18N
        amount_Label.setName("amount_Label"); // NOI18N
        amount_Label.setVisible(false);

        receive_Date_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        receive_Date_Label.setText(resourceMap.getString("receive_Date_Label.text")); // NOI18N
        receive_Date_Label.setName("receive_Date_Label"); // NOI18N
        receive_Date_Label.setVisible(false);

        notes_Label.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        notes_Label.setText(resourceMap.getString("notes_Label.text")); // NOI18N
        notes_Label.setName("notes_Label"); // NOI18N
        notes_Label.setVisible(false);

        id_Textfield.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        id_Textfield.setName("id_Textfield"); // NOI18N
        id_Textfield.setVisible(false);

        mem_Name_Textfield.setEditable(false);
        mem_Name_Textfield.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        mem_Name_Textfield.setName("mem_Name_Textfield"); // NOI18N
        mem_Name_Textfield.setVisible(false);

        service_Type_ComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "زواج", "وضع", "وفاه", "غير ذلك" }));
        service_Type_ComboBox.setName("service_Type_ComboBox"); // NOI18N
        service_Type_ComboBox.setVisible(false);

        request_Date_DateChooser.setName("request_Date_DateChooser"); // NOI18N
        request_Date_DateChooser.setVisible(false);

        incoming_Number_Textfield.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        incoming_Number_Textfield.setName("incoming_Number_Textfield"); // NOI18N
        incoming_Number_Textfield.setVisible(false);

        amount_Textfield.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        amount_Textfield.setName("amount_Textfield"); // NOI18N
        amount_Textfield.setVisible(false);

        receive_Date_DateChooser.setName("receive_Date_DateChooser"); // NOI18N
        receive_Date_DateChooser.setVisible(false);

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        notes_TextArea.setColumns(20);
        notes_TextArea.setRows(5);
        notes_TextArea.setName("notes_TextArea"); // NOI18N
        jScrollPane1.setViewportView(notes_TextArea);
        jScrollPane1.setVisible(false);

        save_Subvention_Button.setText(resourceMap.getString("save_Subvention_Button.text")); // NOI18N
        save_Subvention_Button.setName("save_Subvention_Button"); // NOI18N
        save_Subvention_Button.setVisible(false);
        save_Subvention_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                save_Subvention_ButtonActionPerformed(evt);
            }
        });

        edit_Subvention_Button.setText(resourceMap.getString("edit_Subvention_Button.text")); // NOI18N
        edit_Subvention_Button.setName("edit_Subvention_Button"); // NOI18N
        edit_Subvention_Button.setEnabled(false);
        edit_Subvention_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                edit_Subvention_ButtonActionPerformed(evt);
            }
        });

        Subvention_Refresh_Button.setAction(actionMap.get("refresh")); // NOI18N
        Subvention_Refresh_Button.setText(resourceMap.getString("Refresh_Subvention.text")); // NOI18N
        Subvention_Refresh_Button.setName("Refresh_Subvention"); // NOI18N
        Subvention_Refresh_Button.setVisible(false);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(Subvention_Refresh_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(save_Subvention_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(40, 40, 40)
                                .addComponent(newDetailButton, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(54, 54, 54)
                                .addComponent(deleteDetailButton, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(82, 82, 82)
                                .addComponent(edit_Subvention_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(326, Short.MAX_VALUE))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 514, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(112, 112, 112)
                                        .addComponent(notes_Label, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                        .addGap(128, 128, 128)
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(id_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(mem_Name_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, 390, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                .addComponent(service_Type_ComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, 164, Short.MAX_VALUE)
                                                .addComponent(incoming_Number_Textfield, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                                                .addComponent(amount_Textfield, javax.swing.GroupLayout.Alignment.TRAILING)
                                                .addComponent(receive_Date_DateChooser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(request_Date_DateChooser, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addGap(96, 96, 96)
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(receive_Date_Label, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                                            .addComponent(amount_Label, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                                            .addComponent(incoming_Number_Label, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                                            .addComponent(request_Date_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 109, Short.MAX_VALUE)
                                            .addComponent(service_Type_Label, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                                            .addComponent(mem_Id_Label, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE)
                                            .addComponent(id_Label, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))))
                                .addContainerGap())))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(detailScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1009, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(detailScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(edit_Subvention_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(deleteDetailButton)
                    .addComponent(newDetailButton))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(372, 372, 372)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(Subvention_Refresh_Button)
                            .addComponent(save_Subvention_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(id_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(id_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addGap(22, 22, 22)
                                        .addComponent(mem_Name_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(service_Type_ComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(request_Date_DateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(incoming_Number_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(amount_Textfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(63, 63, 63)
                                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(mem_Id_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(service_Type_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(request_Date_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(incoming_Number_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(amount_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(receive_Date_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(29, 29, 29)
                                        .addComponent(notes_Label, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addGap(274, 274, 274)
                                .addComponent(receive_Date_DateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(80, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("الإعانات", jPanel2);

        jPanel4.setName("التقارير"); // NOI18N

        Report_1_Button.setText(resourceMap.getString("Report_1_Button.text")); // NOI18N
        Report_1_Button.setToolTipText(resourceMap.getString("Report_1_Button.toolTipText")); // NOI18N
        Report_1_Button.setName("Report_1_Button"); // NOI18N
        Report_1_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Report_1_ButtonActionPerformed(evt);
            }
        });

        Report_2_Button.setText(resourceMap.getString("Report_2_Button.text")); // NOI18N
        Report_2_Button.setName("Report_2_Button"); // NOI18N
        Report_2_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Report_2_ButtonActionPerformed(evt);
            }
        });

        Report_3_Button.setText(resourceMap.getString("Report_3_Button.text")); // NOI18N
        Report_3_Button.setName("Report_3_Button"); // NOI18N
        Report_3_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Report_3_ButtonActionPerformed(evt);
            }
        });

        Report_4_Button.setText(resourceMap.getString("Report_4_Button.text")); // NOI18N
        Report_4_Button.setName("Report_4_Button"); // NOI18N
        Report_4_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Report_4_ButtonActionPerformed(evt);
            }
        });

        Report_5_Button.setText(resourceMap.getString("Report_5_Button.text")); // NOI18N
        Report_5_Button.setName("Report_5_Button"); // NOI18N
        Report_5_Button.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Report_5_ButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(114, Short.MAX_VALUE)
                .addComponent(Report_5_Button)
                .addGap(34, 34, 34)
                .addComponent(Report_4_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addComponent(Report_3_Button)
                .addGap(34, 34, 34)
                .addComponent(Report_2_Button)
                .addGap(47, 47, 47)
                .addComponent(Report_1_Button, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(34, 34, 34))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Report_1_Button)
                    .addComponent(Report_2_Button)
                    .addComponent(Report_3_Button)
                    .addComponent(Report_4_Button)
                    .addComponent(Report_5_Button))
                .addContainerGap(593, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab(resourceMap.getString("التقارير.TabConstraints.tabTitle"), jPanel4); // NOI18N

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1101, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 642, Short.MAX_VALUE)
        );

        menuBar.setName("menuBar"); // NOI18N
        menuBar.add(Box.createHorizontalGlue());

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        helpMenu.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setText(resourceMap.getString("aboutMenuItem.text")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        fileMenu.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        fileMenu.setName("fileMenu"); // NOI18N

        newRecordMenuItem.setAction(actionMap.get("newRecord")); // NOI18N
        newRecordMenuItem.setText(resourceMap.getString("newRecordMenuItem.text")); // NOI18N
        newRecordMenuItem.setName("newRecordMenuItem"); // NOI18N
        fileMenu.add(newRecordMenuItem);

        jSeparator1.setName("jSeparator1"); // NOI18N
        fileMenu.add(jSeparator1);

        saveMenuItem.setAction(actionMap.get("save")); // NOI18N
        saveMenuItem.setText(resourceMap.getString("saveMenuItem.text")); // NOI18N
        saveMenuItem.setName("saveMenuItem"); // NOI18N
        fileMenu.add(saveMenuItem);

        refreshMenuItem.setAction(actionMap.get("refresh")); // NOI18N
        refreshMenuItem.setText(resourceMap.getString("refreshMenuItem.text")); // NOI18N
        refreshMenuItem.setName("refreshMenuItem"); // NOI18N
        fileMenu.add(refreshMenuItem);

        jSeparator2.setName("jSeparator2"); // NOI18N
        fileMenu.add(jSeparator2);

        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setText(resourceMap.getString("exitMenuItem.text")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        statusPanel.setName("statusPanel"); // NOI18N
        statusPanel.setVisible(false);

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N
        statusPanelSeparator.setVisible(false);

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 1077, Short.MAX_VALUE)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 1101, Short.MAX_VALUE)
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 84, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel))
                .addGap(12, 12, 12))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);

        bindingGroup.bind();
    }// </editor-fold>//GEN-END:initComponents

private void saveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_saveButtonActionPerformed

private void save_Subvention_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_save_Subvention_ButtonActionPerformed
    try {
        //new String(txtName.getText().getBytes(), "UTF-8");
        Subvention subvention = new Subvention();
        subvention.setId(Integer.parseInt(id_Textfield.getText()));
        subvention.setMemId(new Members(memberShipId));
        subvention.setServiceType(service_Type_ComboBox.getSelectedItem().toString());
        subvention.setAmount(Integer.parseInt(amount_Textfield.getText()));
        subvention.setIncomingNumber(Integer.parseInt(incoming_Number_Textfield.getText()));
        subvention.setReceiveDate(receive_Date_DateChooser.getDate());
        subvention.setRequestDate(request_Date_DateChooser.getDate());
        subvention.setNotes(notes_TextArea.getText());
        if (subventionFlag == 1) {
            entityManager.persist(subvention);
            resetSubvention();
        } else {
            entityManager.merge(subvention);
        }
        try{
            entityManager.getTransaction().commit();
            entityManager.getTransaction().begin();
            save_Subvention_Button.setEnabled(false);
              JOptionPane.showMessageDialog(null, "تم الحفظ  بنجاح"," تم الحفظ بنجاح",JOptionPane.INFORMATION_MESSAGE);
      resetSubvention();
       Task t=refresh();
            t.execute();

            Thread.sleep(2000L); // remove for real app
            Task tt=refresh();
            tt.execute();
        }catch(Exception e){
            e.printStackTrace();
        } 
    } catch (Exception rex) {
        rex.printStackTrace();
        entityManager.getTransaction().rollback();
        entityManager.getTransaction().begin();
        save_Subvention_Button.setEnabled(true);
             JOptionPane.showMessageDialog(null,"خطأ","حدث خطأ فى حفظ التغيرات ",JOptionPane.ERROR_MESSAGE);
    }
    Subvention_Refresh_Button.setEnabled(true);
    
}//GEN-LAST:event_save_Subvention_ButtonActionPerformed

private void edit_Subvention_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_edit_Subvention_ButtonActionPerformed
    int index = masterTable.getSelectedRow();
    membershipdemo.Members m = list.get(masterTable.convertRowIndexToModel(index));
    Collection<membershipdemo.Subvention> ss = m.getSubventionList();
    int[] selected = detailTable.getSelectedRows();
    membershipdemo.Subvention s = null;
    for (int idx = 0; idx < selected.length; idx++) {
        selected[idx] = detailTable.convertRowIndexToModel(selected[idx]);
        int count = 0;
        Iterator<membershipdemo.Subvention> iter = ss.iterator();
        while (count++ < selected[idx]) {
            iter.next();
        }
        s = iter.next();
    }
    id_Label.setVisible(true);
    id_Textfield.setVisible(true);
    id_Textfield.setText(s.getId().toString());
    id_Textfield.setEnabled(false);

    mem_Id_Label.setVisible(true);
    mem_Name_Textfield.setVisible(true);
    mem_Name_Textfield.setText(s.getMemId().getMemName());

    service_Type_Label.setVisible(true);
    service_Type_ComboBox.setVisible(true);
    service_Type_ComboBox.setSelectedItem(s.getServiceType());

    request_Date_Label.setVisible(true);
    request_Date_DateChooser.setVisible(true);
    request_Date_DateChooser.setDate(s.getRequestDate());

    incoming_Number_Label.setVisible(true);
    incoming_Number_Textfield.setVisible(true);
    incoming_Number_Textfield.setText(s.getIncomingNumber() + "");

    amount_Label.setVisible(true);
    amount_Textfield.setVisible(true);
    amount_Textfield.setText(s.getAmount() + "");

    receive_Date_Label.setVisible(true);
    receive_Date_DateChooser.setVisible(true);
    receive_Date_DateChooser.setDate(s.getReceiveDate());

    notes_Label.setVisible(true);
    jScrollPane1.setVisible(true);
    notes_TextArea.setText(s.getNotes());

    subventionFlag = 2;
    save_Subvention_Button.setVisible(true);
    Subvention_Refresh_Button.setEnabled(true);
    Subvention_Refresh_Button.setVisible(true);
    save_Subvention_Button.setEnabled(true);
  
}//GEN-LAST:event_edit_Subvention_ButtonActionPerformed

private void deleteDetailButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteDetailButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_deleteDetailButtonActionPerformed

private void newDetailButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newDetailButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_newDetailButtonActionPerformed

private void browesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browesActionPerformed
 
    
    
    if(chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {

                try {
                    imagePath=chooser.getSelectedFile().getAbsolutePath();
                    System.out.println(" imagepath "+imagePath);
                    Image bi = ImageIO.read(chooser.getSelectedFile());
                 
                    if (bi != null){
                       picturePanel.removeAll();
                            REP(bi);}
                    else
                    JOptionPane.showMessageDialog(null, "File is not an image!");
                    } catch (IOException ioe) {
                    JOptionPane.showMessageDialog(null,
                    "Error Reading File!");
                    }
            }
}//GEN-LAST:event_browesActionPerformed

public void enable_Report_1_Button(){
    Report_1_Button.setEnabled(true);
}
public void enable_Report_2_Button(){
    Report_2_Button.setEnabled(true);
}
public void enable_Report_3_Button(){
    Report_3_Button.setEnabled(true);
}
public void enable_Report_4_Button(){
    Report_4_Button.setEnabled(true);
}
public void enable_Report_5_Button(){
   Report_5_Button.setEnabled(true);
}


private void Report_1_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Report_1_ButtonActionPerformed
    Report report=new Report(this);
    report.setVisible(true);
    Report_1_Button.setEnabled(false);
}//GEN-LAST:event_Report_1_ButtonActionPerformed

private void Report_2_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Report_2_ButtonActionPerformed
    Report1 report1=new Report1(this);
    report1.setVisible(true);
    Report_2_Button.setEnabled(false);// TODO add your handling code here:
}//GEN-LAST:event_Report_2_ButtonActionPerformed

private void Report_3_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Report_3_ButtonActionPerformed
    Report3 report3=new Report3(this);
    report3.setVisible(true);
    Report_3_Button.setEnabled(false);
}//GEN-LAST:event_Report_3_ButtonActionPerformed

private void Report_4_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Report_4_ButtonActionPerformed
    Report4 report4=new Report4(this);
    report4.setVisible(true);
    Report_4_Button.setEnabled(false);
}//GEN-LAST:event_Report_4_ButtonActionPerformed

private void Subvention_Refresh_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Subvention_Refresh_ButtonActionPerformed
        try {
            Task t=refresh();
            t.execute();

            Thread.sleep(2000L); // remove for real app
            Task tt=refresh();
            tt.execute();
            save_Subvention_Button.setEnabled(false);
            edit_Subvention_Button.setEnabled(false);
            edit_Subvention_Button.setVisible(true);
        } catch (InterruptedException ex) {
            Logger.getLogger(MemberShipDemoView.class.getName()).log(Level.SEVERE, null, ex);
        }
}//GEN-LAST:event_Subvention_Refresh_ButtonActionPerformed

private void Report_5_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Report_5_ButtonActionPerformed
    Report5 report5=new Report5(this);
    report5.setVisible(true);
    Report_5_Button.setEnabled(false);
}//GEN-LAST:event_Report_5_ButtonActionPerformed

       private void REP(Image bi) {
      JLabel picLabel = new JLabel(new ImageIcon(bi));
      picturePanel.setVisible(true);
        picturePanel.add(picLabel,BorderLayout.CENTER);
        picturePanel.revalidate();
        picturePanel.repaint();
   
                System.out.println("rep done");
            }
       
       
        public boolean validateNumber(String number)
	 {
		 boolean valid=false;
		 	String numToken="[\\p{Digit}&&[0123456789]]+";
		 	
		 	if(number.matches(numToken)){
		 		System.out.println("Matching number  ?  "+number.matches(numToken));
		 	valid=true;
		 	
		 	}
		 	
		 	
		 	
		 	return valid;
	 }
	
	public boolean validateEmail(String email)
	{
		String regEx = "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}\\b";
		System.out.println("validating email "+email+" matching "+email.matches(regEx));
		return email.matches(regEx);
	}
        public boolean validateDate(Date date)
        {
         return  date.after(new Date());
        }
        public void hideSubvention()
        {
            id_Label.setVisible(false);
        id_Textfield.setVisible(false);

        mem_Id_Label.setVisible(false);
        mem_Name_Textfield.setVisible(false);
        mem_Name_Textfield.setText("");
        service_Type_Label.setVisible(false);
        service_Type_ComboBox.setVisible(false);

        request_Date_Label.setVisible(false);
        request_Date_DateChooser.setVisible(false);

        incoming_Number_Label.setVisible(false);
        incoming_Number_Textfield.setVisible(false);

        amount_Label.setVisible(false);
        amount_Textfield.setVisible(false);

        receive_Date_Label.setVisible(false);
        receive_Date_DateChooser.setVisible(false);

        notes_Label.setVisible(false);
        jScrollPane1.setVisible(false);

      
       // save_Subvention_Button.setVisible(false);
        Subvention_Refresh_Button.setEnabled(false);
        Subvention_Refresh_Button.setVisible(false);
        edit_Subvention_Button.setEnabled(false);
        }
int flag = 0;    // if this flag =1 the new is clicked if flag =2 then edit is clicked 
    Integer memberShipId;
    String nameString;
    private int subventionFlag;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField ID;
    private javax.swing.JButton Report_1_Button;
    private javax.swing.JButton Report_2_Button;
    private javax.swing.JButton Report_3_Button;
    private javax.swing.JButton Report_4_Button;
    private javax.swing.JButton Report_5_Button;
    private javax.swing.JButton Subvention_Refresh_Button;
    private javax.swing.JTextField address;
    private javax.swing.JLabel amount_Label;
    private javax.swing.JTextField amount_Textfield;
    private com.toedter.calendar.JDateChooser birthDate;
    private javax.swing.JButton browes;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JTextField currentJob;
    private com.toedter.calendar.JDateChooser dateOfNatID;
    private com.toedter.calendar.JDateChooser deductionDate;
    private javax.swing.JButton deleteButton;
    private javax.swing.JButton deleteDetailButton;
    private javax.swing.JScrollPane detailScrollPane;
    private javax.swing.JTable detailTable;
    private javax.swing.JButton edit_Subvention_Button;
    private javax.swing.JTextField eductaion;
    private javax.swing.JTextField email;
    private javax.persistence.EntityManager entityManager;
    private javax.swing.JLabel errorLabel;
    private com.toedter.calendar.JDateChooser hireDate;
    private javax.swing.JTextField homePhone;
    private javax.swing.JLabel id_Label;
    private javax.swing.JTextField id_Textfield;
    private javax.swing.JLabel incoming_Number_Label;
    private javax.swing.JTextField incoming_Number_Textfield;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JRadioButton jRadioButton1;
    private javax.swing.JRadioButton jRadioButton2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextField jobDegree;
    private com.toedter.calendar.JDateChooser joiningDate;
    private java.util.List<membershipdemo.Members> list;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JScrollPane masterScrollPane;
    private javax.swing.JTable masterTable;
    private javax.swing.JLabel mem_Id_Label;
    private javax.swing.JTextField mem_Name_Textfield;
    private javax.swing.JTextField membershipID;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JTextField mobile;
    private javax.swing.JTextField name;
    private javax.swing.JTextField nationalID;
    private javax.swing.JButton newButton;
    private javax.swing.JButton newDetailButton;
    private javax.swing.JLabel notes_Label;
    private javax.swing.JTextArea notes_TextArea;
    private javax.swing.JPanel picturePanel;
    private javax.swing.JTextField placeOfBirth;
    private javax.swing.JProgressBar progressBar;
    private javax.persistence.Query query;
    private com.toedter.calendar.JDateChooser receive_Date_DateChooser;
    private javax.swing.JLabel receive_Date_Label;
    private javax.swing.JButton refreshButton;
    private com.toedter.calendar.JDateChooser request_Date_DateChooser;
    private javax.swing.JLabel request_Date_Label;
    private javax.swing.JButton saveButton;
    private javax.swing.JButton save_Subvention_Button;
    private javax.swing.JComboBox service_Type_ComboBox;
    private javax.swing.JLabel service_Type_Label;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JSeparator statusPanelSeparator;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;
    private JDialog aboutBox;
    
    private boolean saveNeeded;
}
